#ifndef WINDOWSURFACE_H
#define WINDOWSURFACE_H

#include <QtCore>

#include <QPaintDevice>

#include <QtGui/private/qwindowsurface_p.h>

class OGraphicsSystem;
class WindowSurface : public QWindowSurface
{
public:
    WindowSurface(QWidget *window, OGraphicsSystem *system);
    ~WindowSurface();

    QPaintDevice *paintDevice();
    void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
    void setGeometry(const QRect &rect);
    bool scroll(const QRegion &area, int dx, int dy);

    void beginPaint(const QRegion &region);
    void endPaint(const QRegion &region);
    void setVisible(bool visible);
    void raise();
    void lower();
    Qt::WindowFlags setWindowFlags(Qt::WindowFlags type);
    Qt::WindowFlags windowFlags() const;

private:
    OGraphicsSystem *m_system;
    quint32 m_id;
    QSharedMemory m_shared;
    QImage m_image;
    Qt::WindowFlags window_flags;
};

#endif // WINDOWSURFACE_H
